import { TransferReqVO } from '@/api/crm/permission'
import clueApi from '@/api/declaration/crm/clueApi'
import httpRequest from '@/config/axios/httpRequest'
import { CrmClueModel } from '@/models/crm/CrmClueModel'


// 查询线索列表
export const getCluePage = async (params: any) => {
  return await httpRequest.get(clueApi.GetCluePage, { params })
}

// 查询线索详情
export const getClue = async (id: number) => {
  return await httpRequest.get(clueApi.GetClue, { params: { id } })
}

// 新增线索
export const createClue = async (data: CrmClueModel) => {
  return await httpRequest.post(clueApi.CreateClue, { data })
}

// 修改线索
export const updateClue = async (data: CrmClueModel) => {
  return await httpRequest.put(clueApi.UpdateClue, { data })
}

// 删除线索
export const deleteClue = async (id: number) => {
  return await httpRequest.delete(clueApi.DeleteClue, { params: { id } })
}

// 导出线索 Excel
export const exportClue = async (params) => {
  return await httpRequest.download(clueApi.ExportClue, { params })
}

// 线索转移
export const transferClue = async (data: TransferReqVO) => {
  return await httpRequest.put(clueApi.TransferClue, { data })
}

// 线索转化为客户
export const transformClue = async (id: number) => {
  return await httpRequest.put(clueApi.TransformClue, { params: { id } })
}

// 获得分配给我的、待跟进的线索数量
export const getFollowClueCount = async () => {
  return await httpRequest.get(clueApi.GetFollowClueCount)
}
